package tech.bmatch.meituan;

import org.junit.Test;
import tech.bmatch.meituan.model.Dishes;
import tech.bmatch.meituan.service.DishesService;
import tech.bmatch.meituan.service.impl.DishesServiceImpl;

import java.util.List;

public class DishesAddTest {
    private static DishesService dishesService = new DishesServiceImpl();

    public static void main(String[] args) {
        init();
        List<Dishes> dishesList = dishesService.search("桥头排骨");
        for (Dishes dishes : dishesList) {

            String n = dishes.getMerchantName();
            if (n == "桥头排骨") {
                System.out.println("欢迎来到" + dishes.getMerchantName() + "店");
                System.out.println("菜名：" + dishes.getDishesName());
                System.out.println("份量：" + dishes.getServing());
                System.out.println("-------------------------------");
            } else {
                System.out.println("-------------------------------");
            }
        }
    }

    @Test
    private static void init() {
        Dishes dishes = new Dishes();
        dishes.setId("1");
        dishes.setMerchantName("桥头排骨");
        dishes.setDishesName("宫保鸡丁");
        dishes.setServing("大份");
        dishesService.adds(dishes);

        dishes = new Dishes();
        dishes.setId("2");
        dishes.setMerchantName("桥头排骨");
        dishes.setDishesName("辣子鸡");
        dishes.setServing("中份");
        dishesService.adds(dishes);
    }
}
